package com.zpark.controller;

import com.github.pagehelper.PageInfo;
import com.zpark.pojo.Ranking;
import com.zpark.service.IRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * @PackageName: com.zaprk.controller
 * @ClassName: RankingController
 * @Description:
 * @author: RZS
 * @date: 2022/10/11  16:39
 */
@RestController
public class RankingController {

    @Autowired
    IRankingService rankingService;

    @RequestMapping("/page")
    public PageInfo<Ranking> findAll(Integer page, Integer size){
        // 调用service层执行查询数据
        List<Ranking> all = rankingService.findAll(page, size);
        // 封装分页信息
        PageInfo<Ranking> info = new PageInfo<>(all);

        return info;
    }
}
